<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <script src="../js/react.js"></script>
  <script src="../js/react-dom.js"></script>
  <script src="https://unpkg.com/babel-core@5.8.38/browser.min.js"></script>
  <title>demo10</title>
</head>
<body>
<div id="example"></div>
<script type="text/babel">
var Hello = React.createClass({
  getInitialState: function() {
    return {
      opacity: 1.0
    };
  },

  componentDidMount: function() {
    this.timer = setInterval(function() {
      var opacity = this.state.opacity;
      opacity -= .05;
      if (opacity < 0.1) {
        opacity = 1.0;
      }
      this.setState({
        opacity: opacity
      });
    }.bind(this), 100);
  },

  render: function() {
    return (
      <div style={{opacity: this.state.opacity}}>
        hello {this.props.name}
      </div>
    );
  }
});

ReactDOM.render(
  <Hello name="huhuhu" />,
  document.getElementById('example')
)
</script>
</body>
</html>
